@extends('Home.User.Common.layout')
@section('title')
    我的简历库_简历管理
@endsection
@section('content')
    <!--  content  -->
    <main class="common_content">
        <div class="container">
            <div class="ct_main">
                @include('Home.User.Resume.resume_menu')
                <ul class="nav-items1 nav-items2" id="tab-content2">
                    <!--我的简历库-->
                    <li class="basic-sets active">
                        <form class="selector-head">
                            <h2>我的简历库<span>(所有简历保护期{{Auth::user()->type==1?$resume_day:$resume_out_day}}天，超过{{Auth::user()->type==1?$resume_day:$resume_out_day}}天会自动变为共享,请及时推荐)</span></h2>
                            <div class="rt">
                                <a href="javascript:;" class="add-new-btn add-client" onclick="open_button('{{route('resume_add')}}','新增简历@if(Auth::user()->type != 1) (推荐新简历后请及时联系负责猎头，以便及时推荐安排；推荐面试结果，请在推荐记录里查看) @endif')" title="新增简历"><i class="icon icon-xinzen"></i></a>
                                <a href="javascript:location.replace(location.href);" class="refresh-btn" title="刷新"><i class="icon icon-shuaxin"></i></a>
                            </div>
                        </form>
                        <div class="layui-form basic-sets-ul">
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>上传时间</th>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>学历</th>
                                    <th>工作经验</th>
                                    <th>求职职位</th>
                                    <th>简历来源</th>
                                    {{--<th>简历归属</th>--}}

                                    {{--<th>求职状态</th>--}}
                                    <th width="130">操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                @foreach($list as $item)
                                    <tr>
                                        <td data-label="编号"> {{$item->id}} </td>
                                        <td data-label="上传时间" title="{{$item->created_at}}"> {{$item->created_at}} </td>
                                        <td data-label="姓名" title="{{$item->name}}"> {{$item->name}} </td>
                                        <td data-label="性别"> {{$item->sex_name}} </td>
                                        <td data-label="学历" title="{{$item->education_name}}"> {{$item->education_name}} </td>
                                        <td data-label="工作经验" title="{{$item->experience_name}}"> {{$item->experience_name}} </td>
                                        <td data-label="求职职位" title="{{$item->position_name}}"> {{$item->position_name}} </td>
                                        <td data-label="简历来源" title="{{$item->user_type.$item->username}}"> {{$item->user_type.$item->username}}</td>
                                        {{--<td data-label="简历归属"> {{$item->assign_username}} </td>--}}

                                        {{--<td data-label="求职状态" title="{{$item->state_name}}"> {{$item->state_name}} </td>--}}
                                        <td data-label="操作" class="tac layui-row layui-col-space10">
                                            <a href="javascript:;" class="edit-btn edit-client" onclick="open_button('{{route('resume_edit',$item->id)}}','查看/编辑简历')" title="查看/编辑简历"><i class="layui-icon">&#xe642;</i></a>
                                            @if (Auth::user()->type == 1)<a href="javascript:;" class="edit-btn edit-client" onclick="open_button('{{route('resume_push',$item->id)}}','推荐职位 （只展示尚未推荐过的职位，已推荐职位不做展示）',1200)" title="推荐职位"><i class="layui-icon">&#xe609;</i></a>@endif
                                            <a href="javascript:;" class="edit-btn edit-client" onclick="open_button('{{route('resume_position',$item->id)}}','职位推荐记录',1200)" title="职位推荐记录"><i class="layui-icon">&#xe60e;</i></a>
                                            @if (Auth::user()->hasAnyRole(['admin']))
                                                <a href="javascript:;" class="edit-btn add-schedule" onclick="del('{{route('resume_del',$item->id)}}')" title="删除"><i class="layui-icon">&#xe640;</i></a>
                                            @endif
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>

                            <!-- 分页 s -->
                            @if($num>1)
                                <div class="news-pager">
                                    <ul class="pagination" id="page">
                                    </ul>
                                    <div class="pageJump">
                                        <span>跳转到</span>
                                        <input type="text"/>
                                        <span>页</span>
                                        <button type="button" class="button">确定</button>
                                    </div>
                                </div>
                            @endif
                            <!-- 分页 e -->
                        </div>
                    </li>
                </ul>

            </div>
        </div>
    </main>
@endsection
@section('footer')
    <script>
        /*删除*/
        function del(url) {
            layer.confirm("你确定要删除吗？此操作不能撤销！", {icon: 3, title:'提示'},
                    function(index){//确定回调
                        $.ajax({
                            type: 'get',
                            url: url,
                            dataType: 'json',
                            success: function(data){
                                if(data.code){
                                    window.location.reload();
                                    layer.close(index);
                                }else{
                                    layer.msg(data.msg,{icon: 5,time:1000});
                                }
                            },
                            error:function() {
                                layer.msg('服务器错误!',{icon: 5,time:1000});
                            }
                        });
                    },function (index) {//取消回调
                        layer.close(index);
                    }
            );
        }
        /***  分页 JS  ***/
        Page({
            num: '{{$num}}',		//页码数
            startnum: '{{$page}}',				//指定页码
            elem:$('#page'),		//指定的元素
            callback:function(n){	//回调函数
                window.location.href = '{{route('resume_self')}}?page='+n;
            }
        });
    </script>
@endsection